//search模块小仓库
import { getSearchInfo } from "@/api"
const state = {
  //search 页面的数据
  searchList:{}
}
const mutations = {
  GETSEARCHLIST(state,searchList) {
    state.searchList = searchList
  }
}
const actions = {
  async getSearchList({commit},payload={}) {
   let result =  await getSearchInfo(payload)
    if (result.code == 200) {
      commit('GETSEARCHLIST',result.data)
    }
  }
}
//getters计算属性就是用来简化state中的数据
const getters = {
  //state就是本仓库中的state
  //goodsList 为 searchList下面的goodsList
  goodsList(state) {
    return state.searchList.goodsList
  },
  attrsList(state) {
    return state.searchList.attrsList
  },
  trademarkList(state) {
    return state.searchList.trademarkList
  }

}
export default {
  state,
  mutations,
  actions,
  getters
}